function neighbor_rf_nodes = find_rf_nodes_udbd(tri, ud_re, y_inter)
neighbor_rf_nodes = zeros(4,2,2); %每条边有四个高斯点,对应两个边界
uc = ud_re(1);
us = ud_re(2);
dc = ud_re(3);
ds = ud_re(4);
%处理上边界
uc_gauss_nodes = tri(uc).edge_gauss(:,:,us);
df_gauss_nodes = uc_gauss_nodes;
df_gauss_nodes(:,2) = y_inter(1);
dc_gauss_nodes = tri(dc).edge_gauss(:,:,ds);
uf_gauss_nodes = dc_gauss_nodes;
uf_gauss_nodes(:,2) = y_inter(2);
for j = 1 : size(df_gauss_nodes,1)
    tmp_df_nodes = get_nodes(tri(dc).nodes, df_gauss_nodes(j,:));
    tmp_uf_nodes = get_nodes(tri(uc).nodes, uf_gauss_nodes(j,:));
    neighbor_rf_nodes(j,:,1) = tmp_df_nodes;
    neighbor_rf_nodes(j,:,2) = tmp_uf_nodes;
end
end

function edge_rf_nodes = get_nodes(nodes, edge_gauss)
%edge_rf_nodes = zeros(size(edge_gauss));
%edge_gauss: 物理单元坐标
%edge_rf_nodes: 参考单元坐标
Jacobi = [-nodes(1,1)+nodes(2,1), nodes(3,1) - nodes(1,1);
    -nodes(1,2)+nodes(2,2), nodes(3,2) - nodes(1,2)];
for i = 1 : 3
    for j = 1 : 4
        x = edge_gauss(1);
        y = edge_gauss(2);
        b = [x- nodes(1,1);y-nodes(1,2)];
        edge_rf_nodes = Jacobi\b;
        % disp(tmp);
        % disp([xi,eta]);
    end
end
end